package cn.edu.seu.herald.informationplatform.servlet;

import java.io.IOException;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.edu.seu.herald.informationplatform.bean.league.RecruitJoin;
import cn.edu.seu.herald.informationplatform.dao.database.RecruitJoinDao;

public class JoinRecruit extends HttpServlet {
	
	@Override
	protected void doPost(HttpServletRequest request,
			HttpServletResponse response)
					throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		response.setContentType("text/html;charset=utf-8");
		
		try {
			RecruitJoinDao recruitJoinAccess = RecruitJoinDao.getDao();
			RecruitJoin recruitJoin = new RecruitJoin();
			recruitJoin.setCollege(null);
			recruitJoin.setContact(null);
			recruitJoin.setDetails(null);
			recruitJoin.setGrade(null);
			recruitJoin.setRecuitId(0);
			recruitJoin.setResumeAddress(null);
			recruitJoin.setTime(null);
			recruitJoin.setTrueName(null);
			recruitJoin.setUserId(0);
			recruitJoinAccess.addRecruitJoin(recruitJoin);
		} catch (SQLException e) {
			response.getWriter().println("FAILURE");
			return;
		}
		response.getWriter().println("SUCCESS");
	}

}
